# coding: utf-8
# @Author: cyl
# @File: files.py
# @Time: 2023/02/20 23:41:33
import os


class FileDir:
    """地址路径"""
    _instance = None

    def __new__(cls, *args, **kwargs):
        if cls._instance is None:
            cls._instance = object.__new__(cls)

        return cls._instance

    # 顶层目录
    base_dir = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
    # allure文件
    reportDir = os.path.join(base_dir, r'src\reports')
    if not os.path.exists(reportDir):
        os.mkdir(reportDir)
    results = os.path.join(base_dir, r'src\reports\results')
    # allure报告
    resultDir = os.path.join(base_dir, r'src\reports\result_dir')
    # yaml路径
    yamlFile = os.path.join(base_dir, r'com\datas')
    # 登陆后写入和获取的token.yaml文件
    tokenFile = os.path.join(base_dir, r'com\config\token.yaml')
    # 全局变量以及局部变量文件
    variableFile = os.path.join(base_dir, r'com\config\variable.yaml')
    # pytest.ini文件路径
    iniDir = os.path.join(base_dir, r'pytest.ini')


f: FileDir = FileDir()
allure_command: str = "allure generate {} -o {} --clean".format(f.results, f.resultDir)
